package gh

import (
	"fmt"
	"net/http"
	"runtime"
	"time"
)

func Tegh() {
	httpClient := http.Client{
		//Timeout: time.Second * 2, //设置httpClicent的超时时间，否则由于响应慢而一直堵塞
	}
	for {
		go func() {
			resp, err := httpClient.Get("https://www.baidu.com/")
			defer resp.Body.Close()
			if err != nil {
				fmt.Printf("http.Get err: %v\n", err)
			} else {
				fmt.Printf(resp.Status)
			}
		}()
		time.Sleep(time.Second * 1)
		fmt.Println("goroutines: ", runtime.NumGoroutine())
	}
}
